/**
 * 摄像机类。
*/
#ifndef __M_CAMERA_H__
#define __M_CAMERA_H__

#include "glm_use.h"

#define DEFAULT_SPEED 2.5f

class Camera
{

    //摄像机位置，前轴，上轴
    glm::vec3 _pos, _front, _up;

    //摄像机偏航角，视野角度（默认45度）
    float yaw, fov;

    //视口大小
    float viewportx, viewporty;

    Camera(float viewportx,
           float viewporty,
           glm::vec3 _pos = glm::vec3(0.0f, 0.0f, 0.0f),
           glm::vec3 _front = glm::vec3(0.0f, 0.0f, -1.0f),
           glm::vec3 _up = glm::vec3(0.0f, 1.0f, 0.0f));
    Camera(Camera &) = delete;
    Camera &operator=(Camera &) = delete;

public:
    //单一实例获取函数
    static Camera &getinstance(float viewportx = -1.0, float viewporty = -1.0);

    //鼠标移动响应函数
    void mouseMove(float sensitivity, float xoffset);

    //重置摄像头函数
    void reset();

    //观察矩阵
    glm::mat4 view() const;

    //投影矩阵
    glm::mat4 projection() const;

    //位置向量
    glm::vec3 Position() const;

    //前轴
    glm::vec3 front() const;

    //上轴
    glm::vec3 up() const;
};

#endif